home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 351-375 / 351 / pdc / pdcsrc.lzh / PDC / Expr.h < prev    next >
C/C++ Source or Header  |  1990-04-06  |  4KB  |  112 lines

  1.  
  2. /* PDC Compiler - A Freely Distributable C Compiler for the Amiga
  3.  *                Based upon prior work by Matthew Brandt and Jeff Lydiatt.
  4.  *
  5.  * PDC Compiler release 3.3 Copyright (C) 1989 Paul Petersen and Lionel Hummel.
  6.  * PDC Software Distribution (C) 1989 Lionel Hummel and Paul Petersen.
  7.  *
  8.  * This code is freely redistributable upon the conditions that this 
  9.  * notice remains intact and that modified versions of this file not be 
  10.  * distributed as part of the PDC Software Distribution without the express
  11.  * consent of the copyright holders.
  12.  *
  13.  *------------------------------------------------------------------
  14.  *
  15.  * $Log:    Expr.h,v $
  16.  * Revision 3.33  90/04/05  22:48:43  lionel
  17.  * Added real unsigned binary and assignment expressions for *, /, and %.
  18.  * 
  19.  * Revision 3.32  90/02/03  16:23:40  lionel
  20.  * None
  21.  * 
  22.  *------------------------------------------------------------------
  23.  */
  24.  
  25. /* Expr.h
  26.  * Expression tree descriptions
  27.  */
  28.  
  29. enum e_node {
  30.     en_void,            /* used for parameter lists */
  31.     en_info,            /* info about parameters    */
  32.     en_comment,         /* source code comments     */
  33.     en_asm,             /* Inline-assembler         */
  34.     en_stabs, en_stabn, /* source level debugging   */
  35.     en_cbw, en_cbl, en_cwl, en_clf, en_cld, en_cfd, en_cdf, en_cfl, en_cdl,
  36.     en_icon, en_fcon, en_labcon, en_nacon, en_autocon, en_intrlab,
  37.     en_b_ref, en_w_ref, en_l_ref, en_ub_ref, en_uw_ref,
  38.     en_ul_ref, en_m_ref, en_f_ref, en_d_ref, en_fcall, en_tempref, 
  39.     en_add, en_uadd,
  40.     en_sub, en_usub,
  41.     en_mul, en_umul,
  42.     en_mod, en_umod,
  43.     en_div, en_udiv,
  44.     en_asadd, en_asuadd,
  45.     en_assub, en_asusub,
  46.     en_asmul, en_asumul,
  47.     en_asdiv, en_asudiv,
  48.     en_asmod, en_asumod,
  49.     en_lsh, en_rsh, en_cond,
  50.     en_assign, en_eq, en_ne, 
  51.     en_asrsh, en_aslsh, en_asand, en_asor,
  52.     en_aseor, en_uminus, en_not, en_compl, en_lt, en_le, en_gt,
  53.     en_ge, en_and, en_or, en_land, en_lor, en_xor, en_ainc,
  54.     en_adec, en_ugt,
  55.     en_fadecd, en_faincd, 
  56.     en_fnegd, en_faddd, en_fsubd, en_fmuld, en_fdivd, en_fmodd,
  57.     en_fadecs, en_faincs, 
  58.     en_fnegs, en_fadds, en_fsubs, en_fmuls, en_fdivs, en_fmods,
  59.     en_uge, en_ule, en_ult
  60. };
  61.  
  62. /* statement node descriptions     */
  63.  
  64. enum e_stmt {
  65.     st_expr, st_while, st_for, st_do, st_if, st_switch,
  66.     st_case, st_goto, st_break, st_continue, st_label,
  67.     st_return, st_comment, st_stabn, st_stabs, st_asm
  68. };
  69.  
  70.  
  71. struct dnode {
  72.     struct dnode   *next;   /* Next dnode in the chain      */
  73.     char           *sp;     /* Up to 2048 bytes of info     */
  74.     int             label;  /* Line label                   */
  75.     int             tag;    /* Type of STAB statement       */
  76.     int             nest;   /* Nesting level                */
  77.     struct enode   *ref;    /* Reference to label           */
  78. };
  79.  
  80. struct enode {
  81.     enum e_node     nodetype;
  82.     short           size;
  83.     short           constflag;
  84.     short           signedflag;
  85.     union {
  86.         long            i;
  87.         double          f;
  88.         char           *sp;
  89.         struct dnode   *dp;
  90.         struct enode   *p[2];
  91.     }               v;
  92. };
  93.  
  94. struct snode {
  95.     enum e_stmt     stype;
  96.     struct snode   *next;   /* next statement           */
  97.     struct enode   *exp;    /* condition or expression  */
  98.     struct snode   *s1, *s2;/* internal statements      */
  99.     int             line;   /* Line number for dbx      */
  100.     long           *label;  /* label number for goto    */
  101.     long            value;  /* Extra value field        */
  102. };
  103.  
  104. struct cse {
  105.     struct cse     *next;
  106.     struct enode   *exp;    /* optimizable expression */
  107.     int             uses;   /* number of uses */
  108.     int             duses;  /* number of dereferenced uses */
  109.     int             voidf;  /* cannot optimize flag */
  110.     int             reg;    /* allocated register */
  111. };
  112.